#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 100

typedef struct StackStruct* Stack;
struct StackStruct{
	int Data[MAXSIZE];
	int Top;
	char Name;
};

Stack stackCreate(char Name);
int stackPop(Stack S);
void stackPush(Stack S,int X);
void stackPrint(Stack S);
void mainProcess(int N);
void movePlate(Stack S1,Stack S2);
void movePlateStep(Stack S1,Stack S2);

int main(){
	int N=0;
	scanf("%d",&N);
	mainProcess(N);
	return 0;
}

Stack stackCreate(char Name){
	Stack S=(Stack)malloc(sizeof(struct StackStruct));
	S->Top=-1;
	S->Name=Name;
	return S;
}

int stackPop(Stack S){
	int ret=0;
	if(S->Top>-1){
		ret=S->Data[S->Top];
		S->Top--;
	}else{
		printf("ERROR in stackPop, Stack is empty!\n");
	}
	return ret;
}

void stackPush(Stack S,int X){
	if(S->Top<MAXSIZE-1){
		S->Top++;
		S->Data[S->Top]=X;
	}else{
		printf("ERROR in stackPush, Stack is full!\n");
	}
	return;
}

void stackPrint(Stack S){
	printf("%c:",S->Name);
	for(int i=0;i<=S->Top;i++){
		printf(" %d",S->Data[i]);
	}
	printf("\n");
	return;
}

void mainProcess(int N){
	Stack S1=stackCreate('a');
	Stack S2=stackCreate('b');
	Stack S3=stackCreate('c');
	Stack T1=S1,T2=S2,T3=S3,Tp;
	for(int i=N;i>0;i--)stackPush(S1,i);
	if(N%2==0){
		Tp=T2;
		T2=T3;
		T3=Tp;
	}
	while(S3->Top!=N-1){		
		movePlate(T1,T3);
        if(S3->Top==N-1)break;
        movePlate(T1,T2);
		Tp=T1;
		T1=T3;
		T3=T2;
		T2=Tp;
	}
	return;
}

void movePlate(Stack S1,Stack S2){
	int X;
	if(S1->Top!=-1 && S2->Top!=-1){
		if(S1->Data[S1->Top]>S2->Data[S2->Top]){
			movePlateStep(S2,S1);
		}else{
            movePlateStep(S1,S2);
        }
	}else if(S1->Top!=-1){
		movePlateStep(S1,S2);
	}else if(S2->Top!=-1){
		movePlateStep(S2,S1);	
	}else{
		printf("ERROR in movePlate, both the stack is empty!\n");
	}
	return;
}

void movePlateStep(Stack Sfrom,Stack Sto){
	int X=stackPop(Sfrom);
	stackPush(Sto,X);
	printf("%c -> %c\n",Sfrom->Name,Sto->Name);
	return;
}

